
   <?php
   @include_once("connect.php");

   $key=$_POST["key"];
        $sql="SELECT title,gid,imgid,price FROM `goodlist1` where title like '%$key%'";
        $result=mysqli_query($conn,$sql);
        // print_r($result);
        $obj=array();

        if($result){
            //  $item=mysqli_fetch_assoc($result);
            while($item=mysqli_fetch_assoc($result)){
            $item["title"]=$item["title"];
            $item["gid"]=$item["gid"];
            $item["imgid"]=$item["imgid"];
            $item["price"]=$item["price"]*1;
            array_push($obj,$item); 
            }
        }else{
        $obj["status"] = false;
        $obj["msg"] = "sql语句有误";
        $obj["sql"] = $sql;
        }
  
        echo json_encode($obj);

?>